#include "PacketObjectMove.h"
#include <iostream>
#include "Buffer.h"
PacketObjectMove::PacketObjectMove(void)
	:
	Packet(PACKET_TYPE::OBJECT_MOVE),
	m_objectID(0),
	m_position()
{

}
PacketObjectMove::PacketObjectMove(long long objID, Position& pos)
	:
	Packet(PACKET_TYPE::OBJECT_MOVE),
	m_objectID(objID),
	m_position(pos)
{

}
PacketObjectMove::PacketObjectMove(Buffer& buffer)
{
	Read(buffer);
}
PacketObjectMove::~PacketObjectMove(void)
{

}

int PacketObjectMove::Write(void* buffer)
{
	int len = sizeof(*this) - 4;
	memcpy(buffer, (char*)this + 4, len); 
	return len;
}
void PacketObjectMove::Read(Buffer& buffer)
{
	buffer.Read(reinterpret_cast<char*>(this) + 4, sizeof(PacketObjectMove) - 4);
}
long long PacketObjectMove::GetObjectID(void) const
{
	return m_objectID;
}
Position& PacketObjectMove::GetPosition(void)
{
	return m_position;
}